package com.chis.jxc;

import com.chis.jmdatatimer.comm.TxMgmtModule;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

/**
 * 
 * @Description  更新mysql中库存表中生产日期为空的数据，更新成能找到的最大日期
 * @Company zwx
 * @author wlj
 * @version 2020年01月14日
 */
public class ProduceDate {

    public static void main(String[] args) {
        String opr = args[0];
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring.xml"});
        context.start();
        TxMgmtModule txMgmtModule = (TxMgmtModule) context.getBean("TxMgmtModule");
        String s = "86978977000920#P3K721M@86903115000180#201707011@86902060000108#20180406@86901109000093#201709107@86909610000021#A20180630@86903115000180#201803003@86902060000108#20180408@86981597000027#201805060@86909687000054#201805019@86981597000027#201805058@86900755000600#201811067@86905626000062#G201806001@86900509000030#B201704031@86901960000874#201805017-2@86901960000553#20190401@86901960000553#20181207@86900080000146#201801003@86979524000264#r024709@86903115000425#201904009@86909610000052#E20180716@86902060000375#201703a027@86901109000093#201805039@86902060000109#20180610@86901960001260#201801001@86906080000018#201712111-1@86904445000079#20180804@86906080000018#201712112-2@86902291000366#201903009R@86978633001438#N034531@86906629000011#201803017-1@86900080000146#201711024@86981597000028#201804052@86902060000046#20180511@86900473000050#20181211@86902700000160#201801YB07@86901960001260#201803012@86900160001117#201803035@86978977000869#P1A441M@86979275000025#20181131@86978471001072#AHPVA344AA@86903115000180#201802002@86900080000146#201710016@86901202000021#201707248@86900755000600#201804022@86901960001260#201806027@86901109000091#201801004@86900509000053#C201805091@86978977000999#P3F901M@86904445000079#20170803@86905734000152#201803024T@86909687000016#201804017@86901960000096#201704022-3@86900509000030#B201706039@86978471001072#AHPVA377AA@86909687000016#201711040@86904560000022#201703031-2@86901960000874#201802005-1@86900509000054#C201706067@86900509000053#C201709109@86978977000920#P3M442M@86900080000022#201803003@86900509000053#C201804065@86978977000920#P3K101M@86903115000180#201712018@86978977000869#P1A341M@86901202000020#201801010@86900509000030#B201707043@86900509000053#C201803052@86979524000264#R017112@86900755000853#201810113@86902060000046#20180613@86904560000023#201905007@86901960000554#20180805@86902291000366#201905030R@86903301000177#201803030@86901202000020#201711392@86901960001260#201707028@86978977000869#P1A421M@86901109000093#201807074@86900473000050#20181209@86906629000011#201807065-2@86906080000018#201612161-1@86901109000093#201804037@86900509000053#C201708098@86900080000146#201712032@86904560000022#201701014-1@86909610000021#A20180315@86900755000600#201807040@86900538000018#20170708k@86900755000601#201812071@86901960001260#201702002@86901109000092#201708087@86903115000180#201903003@86903115000425#201808027@86978977000869#P1A161M@86903301000178#201803030@86909687000016#201803007@86901109000093#201804036@86978977000869#P1A561M@86902291000083#201807006C@86902700000161#201804XB07@86900080000146#201712041@86900755000600#201809053@86900509000054#C201703024@86900080000146#201801001@86981597000028#201804053@86978633001438#R013664@86909687000054#201805022@86979275000025#20171220@86981324000016#201806031@86904560000022#201701013-2@86900473000050#20180906@86981597000028#201804054@86900538000346#20170502P@86900755000603#201811063@86903115000425#201904008@86900080000022#201803004@86901202000020#201807182@86901960001260#201703004@86901109000093#201709106@86981597000028#201804051@86902700000160#201802YB09@86900080000146#201710019@86979275000025#20170609@86900080000022#201803002@86901109000115#201712017@86905626000062#G201809005@86901202000020#201712418@86909687000054#201805020@86978633001438#R029844@86906080000018#201612160-2@86901109000093#201805038@86909687000016#201712050@86909687000016#201712045@86901960001260#201712038@86909687000016#201704007@86982352000023#R036916@86978633001438#R010746@86905734000152#201804035T@86902700000160#201809YB24@86901960000874#201805016-2@86900755000600#201808048@86902700000160#201712YB31@86978724001125#w80359w72981@86902291000366#201806025R@86900740000264#2018070161@86900509000031#B201702021@86906080000018#201711099-1@86902291000366#201905032R@86906629000009#201806052-1@86900538000131#20170201Y@86981597000027#201805057@86905734000152#201808075T@86901202000020#201809271@86909687000016#201801005@86901960001260#201706021@86905265000089#20190401-3@86901109000115#201712011@86900509000047#A201707008@86978977000869#P1A151M@86903301000177#201802019@86909687000016#201704011@86900755000853#201810108@86905265000089#20180603-3@86901960000554#20181207@86901202000020#201807183@86906629000011#201805044-2@86905626000016#B201806007@86907192000057#201708A011@86907192000071#201708B012@86900080000146#201712040@86979275000025#20180823@86901109000115#201712014@86906629000011#201705039-1@86979275000025#20180722@86904560000023#201706082-1@86902291000366#201807031R@86909687000016#201708030@86906629000010#201801005-2@86906629000011#201804034-1@86900509000053#C201708093@86901109000091#201711155@86900080000146#201712030@86900509000047#A201704002@86904560000022#201703045-1@86900473000050#20181212@86904445000369#20180510@86900509000047#A201707007@86909687000016#201803013@86909687000016#201803011@86902700000160#201806YB19@86907192000071#201711B019@86978977000869#P1A401M@86902700000160#201710YB29@86978977001019#R0A131M@86906629000011#201710063-2@86904560000023#201707098-1@86906080000018#201706039-2@86901960001260#201712040@86901960000554#20181106@86905265000089#20180402-2@86900755000853#201810111@86904445000369#20190506@86900473000050#20190102@86909610000021#A20180418@86909687000016#201711044@86900538000018#20190504K@86902700000160#201809YB25@86906629000011#201805046-1@86902700000160#201807YB22@86901960001253#201808051-2@86901109000092#201708086@86902060000047#201806014@86978724001125#T76106T30392@86905734000152#201807068T@86909610000021#A20180311@86905734000152#201804039T@86902060000047#20180305@86978633001438#R029467@86901109000093#201709105@86901960000554#20190401@86906629000011#201803024-1@86906080000018#201706039-1@86909687000016#201803009@86900080000146#201801004@86901960001260#201707034@86903301000178#201802019@86900080000015#201608003@86901202000020#201802048@86978977000869#P1A351M@86903301000177#201803029@86900080000146#201801002@86900080000022#201704001@86979275000025#20180826@86903115000425#201803010@86909687000016#201710037@86900509000054#C201706068@86905265000089#20180101-2@86905734000152#201810083T@86900538000018#201703034@86902060000109#20181018@86981742000018#YHBVC676AA@86979275000025#20171116@86901960000874#201604005-1@86909687000016#201709033@86906629000011#201805043-1@86905626000062#G201809006@86902291000366#201906036R@86909687000016#201703004@86902291000366#201904024R@86906629000010#201802011-1@86906080000018#201712108-2@86905734000145#20170829@86905734000152#201805051T@86905626000055#F201806022@86907192000057#201708A010@86909687000016#201711043@86900755000600#201806035@86978724001125#T24281S69938@86900755000600#201806033@86903115000425#20180501-8@86900509000054#C201703022@86901960001260#201801003@86903301000177#201802020@86902291000366#201903020R@86905897000068#201806081-2@86900473000050#20181107@86901202000020#201811343@86904445000369#20190711@86979524000264#R017114@86982352000023#S005677@86902291000366#201904026R@86900755000600#201803014@86904560000022#201703035-2@86900509000054#C201608089@86905734000145#201802005Q@86905734000152#201803025T@86907192000096#201809B030@86901202000020#201706201@86900719000073#201807P14@86903301000177#201803041@86906080000018#201612160-1@86902291000366#201906035R@86909687000016#201708027@86907192000064#201807c008@86901960001253#201803023-1@86902060000108#20190410@86909687000016#201705016@86900080000145#201710022@86900509000030#B201801006@86900755000853#201804018@86901202000020#201809266@86902060000351#201802A027-1@86902700000160#201710YB28@86900473000050#20190404@86904143000173#20180806@86901960000096#201707050-1@86978977001019#R0A591M@86906629000010#201801004-1@86904143000173#20190705@86901202000020#201712431@86900080000146#201712038@86903115000425#201903005@86901109000091#201801003@86901202000020#201802036@86903301000177#201802013@86978977001019#R0A101M@86903301000178#201801010@86904560000023#201706085-2@86902291000366#201806018R@86906629000010#201705035-1@86900509000054#c201703023@86901202000020#201804088@86900509000053#C201803051@86906080000018#201711097-2@86900160001117#201705075@86902700000160#201804YB16@86906080000018#201712105-2@86905626000055#F201807025@86900509000054#C201703025@86979524000233#R021217@86904445000369#20190610@86909610000052#E20180512@86906629000011#201710063-1@86902060000351#201807A139-2@86901202000020#201711386@86904560000023#201708113-1@86904560000023#201706086-1@86978977000920#P3M991M@86900538000018#20170505K@86901960001260#201803015@86978471001072#AHPVA338AB";
        String[] strings = s.split("@");
        for(String d : strings){
            String[] bat = d.split("#");
            Date prodate = txMgmtModule.findProdate(bat[0],bat[1]);

            if(prodate == null){
                System.out.println(bat[0]+"  "+bat[1] + "  无生产日期");
            }else {
                System.out.println(bat[0]+"  "+bat[1] + "  "+prodate);
                if(opr.equals("123")){
                    txMgmtModule.updatestm(bat[0],bat[1],prodate);
                }

            }

        }
    }
}
